﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Engine.Classes {
    import Engine.Helpers.*;
    import Engine.*;

    public class CollisionLookup {

        public var startX:int;
        public var startY:int;
        public var endX:int;
        public var endY:int;
        public var ignoreObjects:Array = null;
        public var colliders:Array;
        public var collidingObject:WorldObject = null;
        public var colliderTypes:int;
        public var flags:int;

        public function CollisionLookup(){
            this.colliders = [];
            this.colliderTypes = Constants.WORLDOBJECT_ALL;
            this.flags = Constants.COLLISION_ALL;
            super();
        }
        public function init(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
            this.ignoreObjects = null;
            this.colliders = [];
            this.collidingObject = null;
            this.colliderTypes = Constants.WORLDOBJECT_ALL;
            this.flags = Constants.COLLISION_ALL;
            this.startX = _arg1;
            this.startY = _arg2;
            this.endX = _arg3;
            this.endY = _arg4;
            this.fixBounds();
        }
        public function fixBounds():void{
            var _local1:int;
            if (this.startX > this.endX){
                _local1 = this.startX;
                this.startX = this.endX;
                this.endX = _local1;
            };
            if (this.startY > this.endY){
                _local1 = this.startY;
                this.startY = this.endY;
                this.endY = _local1;
            };
        }
        public function getFlags(_arg1:int, _arg2:int):int{
            var _local4:Vector3;
            var _local5:Vector3;
            var _local3:int;
            if (this.collidingObject != null){
                _local4 = this.collidingObject.getPositionNoClone();
                _local5 = this.collidingObject.getSizeNoClone();
                _arg1 = (_arg1 - this.startX);
                _arg2 = (_arg2 - this.startY);
                if ((((((((_arg1 >= 0)) && ((_arg2 >= 0)))) && ((_arg1 < _local5.x)))) && ((_arg2 < _local5.y)))){
                    _local3 = this.collidingObject.getCollisionFlags(_arg1, _arg2);
                };
            } else {
                _local3 = this.flags;
            };
            return (_local3);
        }
        public function isLine():Boolean{
            return ((((this.startX == this.endX)) || ((this.startY == this.endY))));
        }

    }
}//package Engine.Classes 
